import request from '@/utils/request'

//上传图片之前，获取阿里云参数
export function getImagesParams(data) {
  return request({
    url: '/public/admin/api/params',
    method: 'get',
    data
  })
}

//上传图片之前，获取阿里云参数
export function getImImagesParams(type) {
  return request({
    url: `/public/admin/mall/api/params?type=${type}`
  })
}


//删除轮播图
export function removeImage(pid){
  return request({
    url: '/product/admin/api/carousel/' + pid,
    method: 'delete'
  })
}

//上传视频
export function uploadVideo(param){
  return request({
    url: '/product/admin/api/video?product_id=' + param.id,
    method: 'post',
    data: param
  })
}

// 随机名称
export function getUUID () {
  return `${str4()}${str4()}-${str4()}-${str4()}-${str4()}-${str4()}${str4()}${str4()}`
}
function str4 () {
  return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)
}
